package com.wcs.exam.controller.admin;

import com.wcs.exam.common.base.Result;
import com.wcs.exam.common.base.annotation.OptLog;
import com.wcs.exam.controller.admin.biz.AdminSysMenuRoleBiz;
import com.wcs.exam.controller.admin.req.AdminSysMenuRoleListReq;
import com.wcs.exam.controller.admin.req.AdminSysMenuRoleSaveReq;
import io.swagger.v3.oas.annotations.Operation;
import io.swagger.v3.oas.annotations.tags.Tag;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotNull;
import lombok.RequiredArgsConstructor;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * Admin-菜单角色关联表
 *
 * @author wcs
 * @since 2024-07-06
 */
@Tag(name = "Admin-菜单角色关联表")
@RestController
@RequiredArgsConstructor
@RequestMapping("/v1/admin/sys/menu/role")
public class AdminSysMenuRoleController {

    @NotNull
    private final AdminSysMenuRoleBiz biz;

    @Operation(summary = "菜单角色关联表-列出")
    @GetMapping(value = "/list")
    public Result<List<Long>> list(@ModelAttribute AdminSysMenuRoleListReq req) {
        return biz.list(req);
    }

    @Operation(summary = "菜单角色关联表-添加")
    @OptLog(value = "菜单角色关联表添加")
    @PostMapping(value = "/save")
    public Result<String> save(@RequestBody @Valid AdminSysMenuRoleSaveReq req) {
        return biz.save(req);
    }

}
